package com.jarvis.config.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.jarvis.config.entity.ConfigFormworkEntity;
import com.jarvis.config.service.ConfigFormworkService;
import com.jarvis.common.utils.PageUtils;
import com.jarvis.common.utils.R;



/**
 * 模板表
 *
 * @author gongxin
 * @email 19910320678@163.com
 * @date 2023-03-31 17:19:43
 */
@RestController
@RequestMapping("config/configformwork")
public class ConfigFormworkController {
    @Autowired
    private ConfigFormworkService configFormworkService;

    /**
     * 列表
     */
    @RequestMapping("/list")
  //  @RequiresPermissions("config:configformwork:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = configFormworkService.queryPage(params);
        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
   // @RequiresPermissions("config:configformwork:info")
    public R info(@PathVariable("id") Long id){
		ConfigFormworkEntity configFormwork = configFormworkService.getById(id);

        return R.ok().put("configFormwork", configFormwork);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
  //  @RequiresPermissions("config:configformwork:save")
    public R save(@RequestBody ConfigFormworkEntity configFormwork){
		configFormworkService.save(configFormwork);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
  //  @RequiresPermissions("config:configformwork:update")
    public R update(@RequestBody ConfigFormworkEntity configFormwork){
		configFormworkService.updateById(configFormwork);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
   // @RequiresPermissions("config:configformwork:delete")
    public R delete(@RequestBody Long[] ids){
		configFormworkService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
